home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / mosmllib / Misc.sml < prev    next >
Encoding:
Text File  |  1997-08-18  |  879 b   |  44 lines  |  [TEXT/R*ch]

  1. (* Misc.sml *)
  2.  
  3. type 'a array  = 'a Array.array
  4.  
  5. fun (g o f) x = g (f x);
  6. fun a before (b: unit) = a;
  7.  
  8. fun getOpt (SOME v, _) = v
  9.   | getOpt (NONE,   a) = a;
  10.  
  11. fun isSome (SOME _) = true 
  12.   | isSome NONE     = false;
  13.  
  14. fun valOf (SOME v) = v
  15.   | valOf NONE     = raise Option.Option;
  16.  
  17. (* The definitions below implement the requirement that units
  18.    Char, String and List are partially opened in the initial environment.
  19.  *)
  20.  
  21. val chr = Char.chr;
  22. val ord = Char.ord;
  23.  
  24. val explode = String.explode;
  25. val implode = String.implode;
  26. val concat = String.concat;
  27. val str = String.str;
  28.  
  29. exception Empty = List.Empty;
  30. val op @ = List.@;
  31. val app = List.app;
  32. val foldl = List.foldl;
  33. val foldr = List.foldr;
  34. val hd = List.hd;
  35. val length = List.length;
  36. val map = List.map;
  37. val null = List.null;
  38. val rev = List.rev;
  39. val tl = List.tl;
  40.  
  41. val vector = Vector.fromList;
  42.  
  43. fun print s = TextIO.print s;
  44.